// 时时彩类型缩水工具
<template>
    <div>
       <div class="shrinkageBox">
           <div class="shrinkageBox-tools flex flex-align-center">
               <div class="shrinkageBox-tools-left">
                   <p class="tools-tips">缩水工具</p>
                   <div class="tools-box flex flex-align-center">
                       <div class="tools-box-item" :class="{'item-active':itemIndex==1}" @click="onChangeTab"><p>二星缩水工具</p></div>
                       <div class="tools-box-item" :class="{'item-active':itemIndex==2}" @click="onChangeTab"><p>三星缩水工具</p></div>
                       <div class="tools-box-item" :class="{'item-active':itemIndex==3}" @click="onChangeTab"><p>四星缩水工具</p></div>
                   </div>
               </div>
               <div class="shrinkageBox-tools-left shrinkageBox-tools-right" v-if='false'>
                   <p class="tools-tips">更多功能</p>
                   <div class="tools-box flex flex-align-center">
                       <div class="tools-box-item" :class="{'item-active':itemIndex==4}" @click="onChangeTab"><p>多能缩水工具</p></div>
                   </div>
               </div>
           </div>
           <!-- 号位/胆码 -->
           <div class="numBox flex">
               <div class="numBox-left flex flex-v">
                   <div class="nomRow flex flex-align-center" v-for='(item,index) in digitArr' :key="index">
                       <p>{{item.digit}}</p>
                       <div class="dmbox" @click="onChangedmBox(index,0,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                       <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,0,item.digit)">
                       <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,0,item.digit)">
                       <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,0,item.digit,it.num)"><p>{{it.num}}</p></div>
                   </div>
                   <div class="h"></div>
               </div>
               <!-- 定位胆 -->
               <div class="numBox-left numBox-right flex flex-v">
                   <div class="nomRow flex flex-align-center" v-for='(item,index) in gallArr' :key="index">
                       <p>{{item.titel}}</p>
                       <div class="dmbox" @click="onChangedmBox(index,1,item.titel)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                       <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,1,item.titel)">
                       <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,1,item.titel)">
                       <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,1,item.titel,it.num)"><p>{{it.num}}</p></div>
                   </div>
                   <div class="h"></div>
               </div>
           </div>
           <!-- 跨码/大小外层box -->
           <div class="cross-code-box flex">
               <!-- 跨码 -->
               <div class="cross-code-box-left flex flex-align-center flex-pack-center">
                    <div class="nomRow flex flex-align-center" v-for='(item,index) in crosscodeArr' :key="index">
                       <p>{{item.titel}}</p>
                       <div class="dmbox" @click="onChangedmBox(index,2,item.titel)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                       <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,2,item.titel)">
                       <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,2,item.titel)">
                       <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,2,item.titel,it.num)"><p>{{it.num}}</p></div>
                   </div>
               </div>
               <!-- 大小 -->
                 <div class="cross-code-box-left cross-code-box-right flex flex-align-center flex-pack-center">
                    <div class="nomRow flex flex-align-center" v-for='(item,index) in sizeArr' :key="index">
                       <p>{{item.titel}}</p>
                       <div class="dmbox" @click="onChangedmBox(index,3,item.titel)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                       <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,3,item.titel)">
                       <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,3,item.titel)">
                       <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,3,item.titel,it.num)"><p>{{it.num}}</p></div>
                </div>
               </div>
           </div>
           <!-- 类型/奇偶box -->
           <div class="cross-code-box flex">
               <!-- 类型 -->
               <div class="cross-code-box-left flex flex-align-center flex-pack-center">
                    <div class="nomRow flex flex-align-center" v-for='(item,index) in typeArr' :key="index">
                       <p>{{item.titel}}</p>
                       <div class="dmbox" @click="onChangedmBox(index,4,item.titel)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                       <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,4,item.titel)">
                       <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,4,item.titel)">
                       <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,4,item.titel,it.num)"><p>{{it.num}}</p></div>
                   </div>
               </div>
               <!-- 奇偶 -->
                 <div class="cross-code-box-left cross-code-box-right flex flex-align-center flex-pack-center">
                    <div class="nomRow flex flex-align-center" v-for='(item,index) in OddandevenArr' :key="index">
                       <p>{{item.titel}}</p>
                       <div class="dmbox" @click="onChangedmBox(index,5,item.titel)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                       <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,5,item.titel)">
                       <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,5,item.titel)">
                       <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,5,item.titel,it.num)"><p>{{it.num}}</p></div>
                </div>
               </div>
           </div>
           <!-- 连号/尾合 -->
           <div class="cross-code-box flex">
               <!-- 连号 -->
               <div class="cross-code-box-left flex flex-align-center flex-pack-center">
                    <div class="nomRow flex flex-align-center" v-for='(item,index) in serialNumberArr' :key="index">
                       <p>{{item.titel}}</p>
                       <div class="dmbox" @click="onChangedmBox(index,6,item.titel)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                       <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,6,item.titel)">
                       <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,6,item.titel)">
                       <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,6,item.titel,it.num)"><p>{{it.num}}</p></div>
                   </div>
               </div>
               <!-- 尾合 -->
                 <div class="cross-code-box-left cross-code-box-right flex flex-align-center flex-pack-center">
                    <div class="nomRow flex flex-align-center" v-for='(item,index) in tailingArr' :key="index">
                       <p>{{item.titel}}</p>
                       <div class="dmbox" @click="onChangedmBox(index,7,item.titel)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                       <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,7,item.titel)">
                       <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,7,item.titel)">
                       <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,7,item.titel,it.num)"><p>{{it.num}}</p></div>
                </div>
               </div>
           </div>
           <!-- 和值/操作面板 -->
           <div class="hezhiBox flex">
               <!-- 和值 -->
               <div class="hezhiBox-left">
                   <div v-for='(item,index) in combinedValueArr' :key="index" class=" flex">
                     <div class="nomRow flex flex-align-center">
                       <p>{{item.titel}}</p>
                       <div class="dmbox" @click="onChangedmBox(index,8,item.titel)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                       <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,8,item.titel)">
                       <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,8,item.titel)">
                    </div>
                    <div class="numBox">
                        <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,8,item.titel,it.num)"><p>{{it.num}}</p></div>
                    </div>
                    </div>
               </div>
               <!-- 操作面板 -->
               <div class="hezhiBox-right flex flex-align-center flex-pack-center">
                   <div class="hezhi-Tools">
                        <div class="TabsBox flex">
                            <div class="tabs-item flex flex-align-center flex-pack-center" @click="onGenerateFun">
                                <img src="@/assets/img/shrinkagetool/shengc.png" alt="">
                                <p>生成</p>
                            </div>
                            <div class="tabs-item flex flex-align-center flex-pack-center" @click="onRotationGroupFun">
                                <img src="@/assets/img/shrinkagetool/zzx.png" alt="">
                                <p>转组选</p>
                            </div>
                            <div class="tabs-item flex flex-align-center flex-pack-center" @click="onExportFun">
                                <img src="@/assets/img/shrinkagetool/dc.png" alt="">
                                <p>导出</p>
                            </div>
                            <div class="tabs-item flex flex-align-center flex-pack-center" @click="onCopyFun">
                                <img src="@/assets/img/shrinkagetool/fz.png" alt="">
                                <p>复制</p>
                            </div>
                            <div class="tabs-item flex flex-align-center flex-pack-center" @click="onResetFun">
                                <img src="@/assets/img/shrinkagetool/cz.png" alt="">
                                <p>重置所有条件</p>
                            </div>
                        </div>
                        <p class="tips">本次生成{{total_num}}注</p>
                   </div>
               </div>
           </div>
           <div class="Num-Box">
                <textarea readonly='true' v-model="NumVal" id='textCont'></textarea>
           </div>
       </div>
    </div>
</template>
<script>
import Date from '@/assets/js/shrinkageToolDate';
export default {
    data () {
        return {
            itemIndex:1, //选择几星缩水
            NumVal:'', //后台生成的数据
            digitArr: Date.TwostarsDate.digitArr,
            gallArr: Date.TwostarsDate.gallArr,
            crosscodeArr:Date.TwostarsDate.crosscodeArr,
            sizeArr:Date.TwostarsDate.sizeArr,
            typeArr:Date.TwostarsDate.typeArr,
            OddandevenArr:Date.TwostarsDate.OddandevenArr,
            serialNumberArr:Date.TwostarsDate.serialNumberArr,
            tailingArr: Date.TwostarsDate.tailingArr,
            combinedValueArr: Date.TwostarsDate.combinedValueArr,
            total_num:0, //生成注数
            // 各个标签杀码定码字段
            thousand_fixed_code_type:1, //千位
            hundred_fixed_code_type:1, //百位
            ten_fixed_code_type:1, //十位
            position_fixed_code_type:1, //个位
            thousand_biliary_code_type:1, //千位胆码
            hundred_biliary_code_type:1,//百位胆码
            ten_biliary_code_type:1, //十位胆码
            position_biliary_code_type:1, //个位胆码
            cross_code_type:1,//跨码
            size_code_type:1,//大小
            code_type_type:1,//类型
            ode_code_type:1,//奇偶
            link_code_type:1,//连号
            tailing_code_type:1,//尾合
            sum_code_type:1,//和值
            // 数组
           thousand_fixed_code_data:[], //千位
            hundred_fixed_code_data:[], //百位
            ten_fixed_code_data:[], //十位
            position_fixed_code_data:[], //个位
            thousand_biliary_code_data:[], //千位胆码
            hundred_biliary_code_data:[],//百位胆码
            ten_biliary_code_data:[], //十位胆码
            position_biliary_code_data:[], //个位胆码
            cross_code_data:[],//跨码
            size_code_data:[],//大小
            code_type_data:[],//类型
            ode_code_data:[],//奇偶
            link_code_data:[],//连号
            tailing_code_data:[],//尾合
            sum_code_data:[],//和值
            star_num:2, // 几星缩水
            is_turn:0, //是否为转组选
            is_export:0, //是否导出
            file_name:'二星缩水结果',
            is_client_export:0,
        }
    },
    methods: {
        onGenerateFun(){ //生成
            this.is_turn=0;
            this.is_export=0;
            this.is_client_export = 0;
            this.postClientShrinkageToolLimit();
        },
        onRotationGroupFun(){ //转组选
            this.is_turn = 1;
            this.is_export=0;
            this.is_client_export = 0;
            this.postClientShrinkageToolLimit();
        },
        onExportFun(){ //导出
            this.is_turn = 0;
            this.is_export=0;
            this.is_client_export = 1;
            this.postClientShrinkageToolLimit();
        },
        onCopyFun(){ //复制
            let text=document.getElementById("textCont");
            text.select(); // 选择对象
            document.execCommand("Copy");  //执行浏览器拷贝
        },
        onResetFun(){ //重置所有条件
            this.resetNum();
            this.NumVal='';
            this.total_num=0;
        },
        resetNum(){ //重置所有数据
                this.thousand_fixed_code_type=1; //千位
                this.hundred_fixed_code_type=1; //百位
                this.ten_fixed_code_type=1; //十位
                this.position_fixed_code_type=1; //个位
                this.thousand_biliary_code_type=1; //千位胆码
                this.hundred_biliary_code_type=1;//百位胆码
                this.ten_biliary_code_type=1; //十位胆码
                this.position_biliary_code_type=1; //个位胆码
                this.cross_code_type=1;//跨码
                this.size_code_type=1;//大小
                this.code_type_type=1;//类型
                this.ode_code_type=1;//奇偶
                this.link_code_type=1;//连号
                this.tailing_code_type=1;//尾合
                this.sum_code_type=1;//和值
                // 数组
                this.thousand_fixed_code_data=[]; //千位
                this.hundred_fixed_code_data=[]; //百位
                this.ten_fixed_code_data=[]; //十位
                this.position_fixed_code_data=[]; //个位
                this.thousand_biliary_code_data=[]; //千位胆码
                this.hundred_biliary_code_data=[];//百位胆码
                this.ten_biliary_code_data=[]; //十位胆码
                this.position_biliary_code_data=[]; //个位胆码
                this.cross_code_data=[];//跨码
                this.size_code_data=[];//大小
                this.code_type_data=[];//类型
                this.ode_code_data=[];//奇偶
                this.link_code_data=[];//连号
                this.tailing_code_data=[];//尾合
                this.sum_code_data=[];//和值
                for(let i in this.digitArr){
                   this.digitArr[i].isChangedmBox = false;
                   for(let k in  this.digitArr[i].numTextArr){
                       this.digitArr[i].numTextArr[k].status = 0;
                   }
                }
                for(let i in this.gallArr){
                   this.gallArr[i].isChangedmBox = false;
                   for(let k in  this.gallArr[i].numTextArr){
                       this.gallArr[i].numTextArr[k].status = 0;
                   }
                }
                for(let i in this.crosscodeArr){
                   this.crosscodeArr[i].isChangedmBox = false;
                   for(let k in  this.crosscodeArr[i].numTextArr){
                       this.crosscodeArr[i].numTextArr[k].status = 0;
                   }
                }
                for(let i in this.sizeArr){
                   this.sizeArr[i].isChangedmBox = false;
                   for(let k in  this.sizeArr[i].numTextArr){
                       this.sizeArr[i].numTextArr[k].status = 0;
                   }
                }
                for(let i in this.typeArr){
                   this.typeArr[i].isChangedmBox = false;
                   for(let k in  this.typeArr[i].numTextArr){
                       this.typeArr[i].numTextArr[k].status = 0;
                   }
                }
                for(let i in this.OddandevenArr){
                   for(let k in  this.OddandevenArr[i].numTextArr){
                       this.OddandevenArr[i].numTextArr[k].status = 0;
                   }
                }
                for(let i in this.tailingArr){
                   this.tailingArr[i].isChangedmBox = false;
                   for(let k in  this.tailingArr[i].numTextArr){
                       this.tailingArr[i].numTextArr[k].status = 0;
                   }
                }
                for(let i in this.combinedValueArr){
                   this.combinedValueArr[i].isChangedmBox = false;
                   for(let k in  this.combinedValueArr[i].numTextArr){
                       this.combinedValueArr[i].numTextArr[k].status = 0;
                   }
                }
                for(let i in this.serialNumberArr){
                   this.serialNumberArr[i].isChangedmBox = false;
                   for(let k in  this.serialNumberArr[i].numTextArr){
                       this.serialNumberArr[i].numTextArr[k].status = 0;
                   }
                }
        },
        onChangeTab(ele){ //几星工具
            this.resetNum();
            if(ele.target.innerText == '二星缩水工具'){
                this.star_num=2;
                this.itemIndex = 1;
                this.file_name='二星缩水结果';
                this.digitArr=Date.TwostarsDate.digitArr;
                this.gallArr=Date.TwostarsDate.gallArr;
                this.crosscodeArr=Date.TwostarsDate.crosscodeArr;
                this.sizeArr=Date.TwostarsDate.sizeArr;
                this.typeArr=Date.TwostarsDate.typeArr;
                this.serialNumberArr=Date.TwostarsDate.serialNumberArr;
                this.OddandevenArr=Date.TwostarsDate.OddandevenArr;
                this.tailingArr= Date.TwostarsDate.tailingArr;
                this.combinedValueArr= Date.TwostarsDate.combinedValueArr;
            }else if(ele.target.innerText == '三星缩水工具'){
                this.itemIndex = 2;
                this.star_num=3;
                this.file_name='三星缩水结果';
                this.digitArr =  Date.ThreestarsDate.digitArr;
                this.gallArr=Date.ThreestarsDate.gallArr;
                this.crosscodeArr=Date.ThreestarsDate.crosscodeArr;
                this.sizeArr=Date.ThreestarsDate.sizeArr;
                this.typeArr=Date.ThreestarsDate.typeArr;
                this.OddandevenArr=Date.ThreestarsDate.OddandevenArr;
                this.serialNumberArr=Date.ThreestarsDate.serialNumberArr;
                this.tailingArr= Date.ThreestarsDate.tailingArr;
                this.combinedValueArr= Date.ThreestarsDate.combinedValueArr;
            }else if(ele.target.innerText == '四星缩水工具'){
                this.itemIndex = 3;
                this.star_num=4;
                this.file_name='四星缩水结果';
                this.digitArr =  Date.FourDate.digitArr;
                this.gallArr=Date.FourDate.gallArr;
                this.crosscodeArr=Date.FourDate.crosscodeArr;
                this.sizeArr=Date.FourDate.sizeArr;
                this.typeArr=Date.FourDate.typeArr;
                this.OddandevenArr=Date.FourDate.OddandevenArr;
                this.serialNumberArr=Date.FourDate.serialNumberArr;
                this.tailingArr= Date.FourDate.tailingArr;
                this.combinedValueArr= Date.FourDate.combinedValueArr;
            }else if(ele.target.innerText == '多能缩水工具'){
                // this.itemIndex = 4;
            }
        },
        /**
         * 参数说明：
         * ele：当前行的索引值,如位数选择某个数字在该行中的索引
         * index：当前某一行在整个数组中的索引，如位数选择中，个位选择在该数组中的索引
         * type:0=位数；1=胆码；2=跨码；3=大小；4=类型；5=奇偶；6=连号；7=尾合；8=和值
         * **/
        onChangedmBox(ele,type,group){ //定码 杀码逻辑切换
           if(type === 0){
               this.digitArr[ele].isChangedmBox = !this.digitArr[ele].isChangedmBox;
               if(this.digitArr[ele].isChangedmBox){
                    switch(group){
                        case '千位':this.thousand_fixed_code_type = 2;break;
                        case '百位':this.hundred_fixed_code_type = 2;break;
                        case '十位':this.ten_fixed_code_type = 2;break;
                        case '个位':this.position_fixed_code_type = 2;break;
                    }
               }else{
                    switch(group){
                        case '千位':this.thousand_fixed_code_type = 1;break;
                        case '百位':this.hundred_fixed_code_type = 1;break;
                        case '十位':this.ten_fixed_code_type = 1;break;
                        case '个位':this.position_fixed_code_type = 1;break;
                    }
               }
           }else if(type === 1){
                this.gallArr[ele].isChangedmBox = !this.gallArr[ele].isChangedmBox;
                if(this.gallArr[ele].isChangedmBox){
                    if(this.star_num == 2){
                        switch(group){
                            case '胆码1':this.ten_biliary_code_type = 2;break;
                            case '胆码2':this.position_biliary_code_type = 2;break;
                        }
                    }else if(this.star_num == 3){
                        switch(group){
                            case '胆码1':this.hundred_biliary_code_type = 2;break;
                            case '胆码2':this.ten_biliary_code_type = 2;break;
                            case '胆码3':this.position_biliary_code_type = 2;break;
                        }
                    }else{
                        switch(group){
                            case '胆码1':this.thousand_biliary_code_type = 2;break;
                            case '胆码2':this.hundred_biliary_code_type = 2;break;
                            case '胆码3':this.ten_biliary_code_type = 2;break;
                            case '胆码4':this.position_biliary_code_type = 2;break;
                        }
                    }
               }else{
                    if(this.star_num == 2){
                        switch(group){
                            case '胆码1':this.ten_biliary_code_type = 1;break;
                            case '胆码2':this.position_biliary_code_type = 1;break;
                        }
                    }else if(this.star_num == 3){
                        switch(group){
                            case '胆码1':this.hundred_biliary_code_type = 1;break;
                            case '胆码2':this.ten_biliary_code_type = 1;break;
                            case '胆码3':this.position_biliary_code_type = 1;break;
                        }
                    }else{
                        switch(group){
                            case '胆码1':this.thousand_biliary_code_type = 1;break;
                            case '胆码2':this.hundred_biliary_code_type = 1;break;
                            case '胆码3':this.ten_biliary_code_type = 1;break;
                            case '胆码4':this.position_biliary_code_type = 1;break;
                        }
                    }
               }
           }else if(type === 2){
                this.crosscodeArr[ele].isChangedmBox = !this.crosscodeArr[ele].isChangedmBox;
                 if(this.crosscodeArr[ele].isChangedmBox){
                    switch(group){
                        case '跨码':this.cross_code_type = 2;break;
                    }
               }else{
                    switch(group){
                        case '跨码':this.cross_code_type = 1;break;
                    }
               }
           }else if(type === 3){
                this.sizeArr[ele].isChangedmBox = !this.sizeArr[ele].isChangedmBox;
                if(this.sizeArr[ele].isChangedmBox){
                    switch(group){
                        case '大小':this.size_code_type = 2;break;
                    }
               }else{
                    switch(group){
                        case '大小':this.size_code_type = 1;break;
                    }
               }
           }else if(type === 4){
                this.typeArr[ele].isChangedmBox = !this.typeArr[ele].isChangedmBox;
                if(this.typeArr[ele].isChangedmBox){
                    switch(group){
                        case '类型':this.code_type_type = 2;break;
                    }
               }else{
                    switch(group){
                        case '类型':this.code_type_type = 1;break;
                    }
               }
           }else if(type === 5){
                this.OddandevenArr[ele].isChangedmBox = !this.OddandevenArr[ele].isChangedmBox;
                if(this.OddandevenArr[ele].isChangedmBox){
                    switch(group){
                        case '奇偶':this.ode_code_type = 2;break;
                    }
               }else{
                    switch(group){
                        case '奇偶':this.ode_code_type = 1;break;
                    }
               }
           }else if(type === 6){
                this.serialNumberArr[ele].isChangedmBox = !this.serialNumberArr[ele].isChangedmBox;
                if(this.serialNumberArr[ele].isChangedmBox){
                    switch(group){
                        case '连号':this.link_code_type = 2;break;
                    }
               }else{
                    switch(group){
                        case '连号':this.link_code_type = 1;break;
                    }
               }
           }else if(type === 7){
                this.tailingArr[ele].isChangedmBox = !this.tailingArr[ele].isChangedmBox;
                if(this.tailingArr[ele].isChangedmBox){
                    switch(group){
                        case '尾合':this.tailing_code_type = 2;break;
                    }
               }else{
                    switch(group){
                        case '尾合':this.tailing_code_type = 1;break;
                    }
               }
           }else if(type === 8){
                this.combinedValueArr[ele].isChangedmBox = !this.combinedValueArr[ele].isChangedmBox;
                if(this.combinedValueArr[ele].isChangedmBox){
                    switch(group){
                        case '和值':this.sum_code_type = 2;break;
                    }
               }else{
                    switch(group){
                        case '和值':this.sum_code_type = 1;break;
                    }
               }
           }
        },
        onChangeItem(index,ele,type,group,val){ // 选码切换
            if(type === 0){
               if(this.digitArr[index].numTextArr[ele].status == 0){
                   this.digitArr[index].numTextArr[ele].status=1;
                   switch(group){
                        case '千位':this.thousand_fixed_code_data.push(val);break;
                        case '百位':this.hundred_fixed_code_data.push(val);break;
                        case '十位':this.ten_fixed_code_data.push(val);break;
                        case '个位':this.position_fixed_code_data.push(val);break;
                    }
               }else{
                   this.digitArr[index].numTextArr[ele].status=0;
                   switch(group){
                        case '千位':
                        let index = this.thousand_fixed_code_data.indexOf(val);
                        if (index > -1) {
                            this.thousand_fixed_code_data.splice(index, 1);
                        };
                        break;
                        case '百位':
                         index = this.hundred_fixed_code_data.indexOf(val);
                        if (index > -1) {
                            this.hundred_fixed_code_data.splice(index, 1);
                        };
                        break;
                        case '十位':
                         index = this.ten_fixed_code_data.indexOf(val);
                        if (index > -1) {
                            this.ten_fixed_code_data.splice(index, 1);
                        };
                        break;
                        case '个位':
                        index = this.position_fixed_code_data.indexOf(val);
                        if (index > -1) {
                            this.position_fixed_code_data.splice(index, 1);
                        };
                        break;
                    }
               }  
            
            }else if(type === 1){
                if(this.gallArr[index].numTextArr[ele].status == 0){
                    this.gallArr[index].numTextArr[ele].status=1;
                    if(this.star_num == 2){
                        switch(group){
                            case '胆码1':this.ten_biliary_code_data.push(val);break;
                            case '胆码2':this.position_biliary_code_data.push(val);break;
                        }
                    }else if(this.star_num == 3){
                        switch(group){
                            case '胆码1':this.hundred_biliary_code_data.push(val);break;
                            case '胆码2':this.ten_biliary_code_data.push(val);break;
                            case '胆码3':this.position_biliary_code_data.push(val);break;
                        }
                    }else{
                        switch(group){
                            case '胆码1':this.thousand_biliary_code_data.push(val);break;
                            case '胆码2':this.hundred_biliary_code_data.push(val);break;
                            case '胆码3':this.ten_biliary_code_data.push(val);break;
                            case '胆码4':this.position_biliary_code_data.push(val);break;
                        }
                    }
                }else{
                    this.gallArr[index].numTextArr[ele].status=0;
                    if(this.star_num == 2){
                    switch(group){
                        case '胆码1':
                        let index = this.ten_biliary_code_data.indexOf(val);
                        if (index > -1) {
                            this.ten_biliary_code_data.splice(index, 1);
                        };
                        break;
                        case '胆码2':
                        index = this.position_biliary_code_data.indexOf(val);
                        if (index > -1) {
                            this.position_biliary_code_data.splice(index, 1);
                        };
                        break;
                    }
                    }else if(this.star_num == 3){
                        switch(group){
                            case '胆码1':
                            let index = this.hundred_biliary_code_data.indexOf(val);
                            if (index > -1) {
                                this.hundred_biliary_code_data.splice(index, 1);
                            };
                            break;
                            case '胆码2':
                            index = this.ten_biliary_code_data.indexOf(val);
                            if (index > -1) {
                                this.ten_biliary_code_data.splice(index, 1);
                            };
                            break;
                            case '胆码3':
                            index = this.position_biliary_code_data.indexOf(val);
                            if (index > -1) {
                                this.position_biliary_code_data.splice(index, 1);
                            };
                            break;
                        }
                    }else{
                        switch(group){
                            case '胆码1':
                            let index = this.thousand_biliary_code_data.indexOf(val);
                            if (index > -1) {
                                this.thousand_biliary_code_data.splice(index, 1);
                            };
                            break;
                            case '胆码2':
                            index = this.hundred_biliary_code_data.indexOf(val);
                            if (index > -1) {
                                this.hundred_biliary_code_data.splice(index, 1);
                            };
                            break;
                            case '胆码3':
                            index = this.ten_biliary_code_data.indexOf(val);
                            if (index > -1) {
                                this.ten_biliary_code_data.splice(index, 1);
                            };
                            break;
                            case '胆码4':
                            index = this.position_biliary_code_data.indexOf(val);
                            if (index > -1) {
                                this.position_biliary_code_data.splice(index, 1);
                            };
                            break;
                        }
                    }
                }
            }else if(type === 2){
                if(this.crosscodeArr[index].numTextArr[ele].status == 0){
                    this.crosscodeArr[index].numTextArr[ele].status=1;
                    switch(group){
                        case '跨码':this.cross_code_data.push(val);break;
                    }
                }else{
                    this.crosscodeArr[index].numTextArr[ele].status=0;
                    switch(group){
                        case '跨码':
                        let index = this.cross_code_data.indexOf(val);
                        if (index > -1) {
                            this.cross_code_data.splice(index, 1);
                        };
                        break;
                    }
                }
           }else if(type === 3){
               if(this.sizeArr[index].numTextArr[ele].status == 0){
                    this.sizeArr[index].numTextArr[ele].status=1;
                     switch(group){
                        case '大小':this.size_code_data.push(val);break;
                    }
               }else{
                    this.sizeArr[index].numTextArr[ele].status=0;
                    switch(group){
                        case '大小':
                        let index = this.size_code_data.indexOf(val);
                        if (index > -1) {
                            this.size_code_data.splice(index, 1);
                        };
                        break;
                    }
               }
            }else if(type === 4){
                if(this.typeArr[index].numTextArr[ele].status == 0){
                    this.typeArr[index].numTextArr[ele].status=1;
                    switch(group){
                        case '类型':this.code_type_data.push(val);break;
                    }
                }else{
                    this.typeArr[index].numTextArr[ele].status=0;
                      switch(group){
                        case '类型':
                        let index = this.code_type_data.indexOf(val);
                        if (index > -1) {
                            this.code_type_data.splice(index, 1);
                        };
                        break;
                    }
                }
            }else if(type === 5){
                if(this.OddandevenArr[index].numTextArr[ele].status == 0){
                    this.OddandevenArr[index].numTextArr[ele].status=1;
                    switch(group){
                        case '奇偶':this.ode_code_data.push(val);break;
                    }
                }else{
                    this.OddandevenArr[index].numTextArr[ele].status=0;
                    switch(group){
                        case '奇偶':
                        let index = this.ode_code_data.indexOf(val);
                        if (index > -1) {
                            this.ode_code_type.splice(index, 1);
                        };
                        break;
                    }
                }
            }else if(type === 6){
                if(this.serialNumberArr[index].numTextArr[ele].status == 0){
                    this.serialNumberArr[index].numTextArr[ele].status=1;
                    switch(group){
                        case '连号':this.link_code_data.push(val);break;
                    }
                }else{
                    this.serialNumberArr[index].numTextArr[ele].status=0;
                    switch(group){
                        case '连号':
                        let index = this.link_code_data.indexOf(val);
                        if (index > -1) {
                            this.link_code_data.splice(index, 1);
                        };
                        break;
                    }
                }
            }else if(type === 7){
                if(this.tailingArr[index].numTextArr[ele].status == 0){
                    this.tailingArr[index].numTextArr[ele].status=1;
                    switch(group){
                        case '尾合':this.tailing_code_data.push(val);break;
                    }
                }else{
                    this.tailingArr[index].numTextArr[ele].status=0;
                    switch(group){
                        case '尾合':
                        let index = this.tailing_code_data.indexOf(val);
                        if (index > -1) {
                            this.tailing_code_data.splice(index, 1);
                        };
                        break;
                    }
                }
           }else if(type === 8){
                if(this.combinedValueArr[index].numTextArr[ele].status == 0){
                    this.combinedValueArr[index].numTextArr[ele].status=1;
                    switch(group){
                        case '和值':this.sum_code_data.push(val);break;
                    }
                }else{
                    this.combinedValueArr[index].numTextArr[ele].status=0;
                    switch(group){
                        case '和值':
                        let index = this.sum_code_data.indexOf(val);
                        if (index > -1) {
                            this.sum_code_data.splice(index, 1);
                        };
                        break;
                    }
                }
                
            }
        },
        onQxFun(index,type,group){ //全选
            if(type === 0){
                for(var i in this.digitArr[index].numTextArr){
                    this.digitArr[index].numTextArr[i].status = 1;
                }
                switch(group){
                        case '千位':
                        for(var i in this.digitArr[index].numTextArr){
                              this.thousand_fixed_code_data.push(this.digitArr[index].numTextArr[i].num);
                        }
                        break;
                        case '百位':
                        for(var i in this.digitArr[index].numTextArr){
                              this.hundred_fixed_code_data.push(this.digitArr[index].numTextArr[i].num);
                        }
                        break;
                        case '十位':
                        for(var i in this.digitArr[index].numTextArr){
                              this.ten_fixed_code_data.push(this.digitArr[index].numTextArr[i].num);
                        }
                        break;
                        case '个位':
                        for(var i in this.digitArr[index].numTextArr){
                              this.position_fixed_code_data.push(this.digitArr[index].numTextArr[i].num);
                        }
                        break;
                    }
            }else if(type === 1){
                 for(var i in this.gallArr[index].numTextArr){
                    this.gallArr[index].numTextArr[i].status = 1;
                }
                if(this.star_num == 2){
                    switch(group){
                            case '胆码1':
                            for(var i in this.gallArr[index].numTextArr){
                                this.ten_biliary_code_data.push(this.gallArr[index].numTextArr[i].num);
                            }
                            break;
                            case '胆码2':
                            for(var i in this.gallArr[index].numTextArr){
                                this.position_biliary_code_data.push(this.gallArr[index].numTextArr[i].num);
                            }
                            break;
                    }
                }else if(this.star_num == 3){
                     switch(group){
                            case '胆码1':
                            for(var i in this.gallArr[index].numTextArr){
                                this.hundred_biliary_code_data.push(this.gallArr[index].numTextArr[i].num);
                            }
                            break;
                            case '胆码2':
                            for(var i in this.gallArr[index].numTextArr){
                                this.ten_biliary_code_data.push(this.gallArr[index].numTextArr[i].num);
                            }
                            break;
                            case '胆码3':
                            for(var i in this.gallArr[index].numTextArr){
                                this.position_biliary_code_data.push(this.gallArr[index].numTextArr[i].num);
                            }
                            break;
                    }
                }else{
                    switch(group){
                            case '胆码1':
                            for(var i in this.gallArr[index].numTextArr){
                                this.thousand_biliary_code_data.push(this.gallArr[index].numTextArr[i].num);
                            }
                            break;
                            case '胆码2':
                            for(var i in this.gallArr[index].numTextArr){
                                this.hundred_biliary_code_data.push(this.gallArr[index].numTextArr[i].num);
                            }
                            break;
                            case '胆码3':
                            for(var i in this.gallArr[index].numTextArr){
                                this.ten_biliary_code_data.push(this.gallArr[index].numTextArr[i].num);
                            }
                            break;
                            case '胆码4':
                            for(var i in this.gallArr[index].numTextArr){
                                    this.position_biliary_code_data.push(this.gallArr[index].numTextArr[i].num);
                                }
                            break;
                    }
                }
            }else if(type === 2){
                 for(var i in this.crosscodeArr[index].numTextArr){
                    this.crosscodeArr[index].numTextArr[i].status = 1;
                }
                switch(group){
                        case '跨码':
                        for(var i in this.crosscodeArr[index].numTextArr){
                                this.cross_code_data.push(this.crosscodeArr[index].numTextArr[i].num);
                        }
                        break;
                }
            }else if(type === 3){
                 for(var i in this.sizeArr[index].numTextArr){
                    this.sizeArr[index].numTextArr[i].status = 1;
                }
                switch(group){
                    case '大小':
                    for(var i in this.sizeArr[index].numTextArr){
                        this.size_code_data.push(this.sizeArr[index].numTextArr[i].num);
                    }
                    break;
                }
            }else if(type === 4){
                 for(var i in this.typeArr[index].numTextArr){
                    this.typeArr[index].numTextArr[i].status = 1;
                }
                switch(group){
                    case '类型':
                    for(var i in this.typeArr[index].numTextArr){
                        this.code_type_data.push(this.typeArr[index].numTextArr[i].num);
                    }
                    break;
                }
            }else if(type === 5){
                 for(var i in this.OddandevenArr[index].numTextArr){
                    this.OddandevenArr[index].numTextArr[i].status = 1;
                }
                switch(group){
                        case '奇偶':
                         for(var i in this.OddandevenArr[index].numTextArr){
                            this.ode_code_data.push(this.OddandevenArr[index].numTextArr[i].num);
                        }
                        break;
                }
            }else if(type === 6){
                for(var i in this.serialNumberArr[index].numTextArr){
                    this.serialNumberArr[index].numTextArr[i].status = 1;
                }
                switch(group){
                        case '连号':
                        for(var i in this.serialNumberArr[index].numTextArr){
                            this.link_code_data.push(this.serialNumberArr[index].numTextArr[i].num);
                        }
                        break;
                }
            }else if(type === 7){
                for(var i in this.tailingArr[index].numTextArr){
                    this.tailingArr[index].numTextArr[i].status = 1;
                }
                 switch(group){
                        case '尾合':
                         for(var i in this.tailingArr[index].numTextArr){
                            this.tailing_code_data.push(this.tailingArr[index].numTextArr[i].num);
                        }
                        break;
                 }
            }else if(type === 8){
                for(var i in this.combinedValueArr[index].numTextArr){
                    this.combinedValueArr[index].numTextArr[i].status = 1;
                }
                switch(group){
                        case '和值':
                        for(var i in this.combinedValueArr[index].numTextArr){
                            this.sum_code_data.push(this.combinedValueArr[index].numTextArr[i].num);
                        }
                        break;
                 }
            }
        },
        onQuXiaoFun(index,type,group){ //取消全选
            if(type === 0){
                for(var i in this.digitArr[index].numTextArr){
                    this.digitArr[index].numTextArr[i].status = 0;
                }
                switch(group){
                        case '千位':this.thousand_fixed_code_data=[];break;
                        case '百位':this.hundred_fixed_code_data=[];break;
                        case '十位':this.ten_fixed_code_data=[]; break;
                        case '个位':this.position_fixed_code_data=[];break;
                    }
            }else if(type === 1){
               for(var i in this.gallArr[index].numTextArr){
                    this.gallArr[index].numTextArr[i].status = 0;
                } 
                if(this.star_num == 2){
                 switch(group){
                        case '胆码1':this.ten_biliary_code_data=[];break;
                        case '胆码2':this.position_biliary_code_data=[];break;
                    }
                }else if(this.star_num == 3){
                    switch(group){
                        case '胆码1':this.hundred_biliary_code_data=[];break;
                        case '胆码2':this.ten_biliary_code_data=[];break;
                        case '胆码3':this.position_biliary_code_data=[];break;
                    }
                }else{
                    switch(group){
                            case '胆码1':this.thousand_biliary_code_data=[];break;
                            case '胆码2':this.hundred_biliary_code_data=[];break;
                            case '胆码3':this.ten_biliary_code_data=[];break;
                            case '胆码4':this.position_biliary_code_data=[];break;
                        }
                }
            }else if(type === 2){
                 for(var i in this.crosscodeArr[index].numTextArr){
                    this.crosscodeArr[index].numTextArr[i].status = 0;
                }
                this.cross_code_data = [];
            }else if(type === 3){
                 for(var i in this.sizeArr[index].numTextArr){
                    this.sizeArr[index].numTextArr[i].status = 0;
                }
                this.size_code_data = [];
            }else if(type === 4){
                 for(var i in this.typeArr[index].numTextArr){
                    this.typeArr[index].numTextArr[i].status = 0;
                }
                this.code_type_data = [];
            }else if(type === 5){
                for(var i in this.OddandevenArr[index].numTextArr){
                    this.OddandevenArr[index].numTextArr[i].status = 0;
                }
                this.ode_code_data = [];
            }else if(type === 6){
                 for(var i in this.serialNumberArr[index].numTextArr){
                    this.serialNumberArr[index].numTextArr[i].status = 0;
                }
                this.link_code_data = [];
            }else if(type === 7){
                for(var i in this.tailingArr[index].numTextArr){
                    this.tailingArr[index].numTextArr[i].status = 0;
                }
                this.tailing_code_data = [];
            }else if(type === 8){
                 for(var i in this.combinedValueArr[index].numTextArr){
                    this.combinedValueArr[index].numTextArr[i].status = 0;
                }
                this.sum_code_data = [];
            }
        },
        postClientShrinkageToolLimit(){ //缩水工具 提交数据
            let lottery_id = this.$store.state.lottery_id;
            this.https('Analyse/postClientShrinkageToolLimit',{
                lottery_id:lottery_id,
                star_num: this.star_num,
                thousand_fixed_code:{
                    type: this.thousand_fixed_code_type, //千位是否为定码
                    data: this.thousand_fixed_code_data.toString(), //	千位定杀码数字
                },
                hundred_fixed_code:{
                    type: this.hundred_fixed_code_type, //百位是否为定吗
                    data:this.hundred_fixed_code_data.toString(), //百位杀码数字
                },
                ten_fixed_code:{
                    type:this.ten_fixed_code_type, //十位是否为定码
                    data:this.ten_fixed_code_data.toString(), //十位定杀码数字
                },
                position_fixed_code:{
                    type:this.position_fixed_code_type, //个位是否为定码
                    data:this.position_fixed_code_data.toString(), //个位定杀码数字
                },
                thousand_biliary_code:{
                    type:this.thousand_biliary_code_type, //	千位胆码是否为定码
                    data:this.thousand_biliary_code_data.toString(), // 千位胆码是否为数字
                },
                hundred_biliary_code:{
                    type:this.hundred_biliary_code_type, //百位胆码是否为定码
                    data:this.hundred_biliary_code_data.toString(), //百位胆码数字
                },
                ten_biliary_code:{
                    type:this.ten_biliary_code_type, //十位胆码是否为定码
                    data:this.ten_biliary_code_data.toString(), //十位胆码数字
                },
                position_biliary_code:{
                    type:this.position_biliary_code_type, //个位胆码是否为定码
                    data:this.position_biliary_code_data.toString(), //个位胆码数字
                },
                cross_code:{
                    type:this.cross_code_type, //跨码是否为杀码
                    data:this.cross_code_data.toString(), //跨码数字
                },
                size_code:{
                    type:this.size_code_type, //大小是否为杀码
                    data:this.size_code_data.toString(), //大小定杀码
                },
                code_type:{
                    type:this.code_type_type, //类型是否为杀码
                    data:this.code_type_data.toString(), //类型定杀码
                },
                ode_code:{
                    type:this.ode_code_type, //奇偶是否为杀码
                    data:this.ode_code_data.toString(), //奇偶定杀码数字
                },
                link_code:{
                    type:this.link_code_type, //连号是否为杀码
                    data:this.link_code_data.toString(), //连号杀码数字
                },
                tailing_code:{
                    type:this.tailing_code_type, //尾合是否为杀码
                    data:this.tailing_code_data.toString(), //尾合杀码数字
                },
                sum_code:{
                    type:this.sum_code_type, //和值是否为杀码
                    data:this.sum_code_data.toString(), //和值是数值
                },
                is_turn:this.is_turn, //是否转组选
                is_export:this.is_export //是否导出
            },'post')
            .then(data => {
                        let root = '';
                        this.total_num = data.total_num;
                        for(var i in data.list){
                            if(root == ''){
                                root = data.list[i]
                            }else{
                                root = root +' '+data.list[i]
                            }
                        }
                    if(this.total_num != 0){
                        if(this.is_client_export == 1){
                            this.ondownload(root);
                        }else{
                            this.NumVal = root;
                        }
                    }else{
                        this.$toast({message:'本次生成0注，请重新选择号码缩水条件。'});
                        this.NumVal = '';
                    }
            })
        },
        ondownload(data){ //下载txt文件
            var CaiPiaoLabel = this.$store.state.CaiPiaoLabel;
            var name = `[彩盟计划][${CaiPiaoLabel}]${this.file_name}`
            download(data, name, "text/plain");
        }
    }
}
</script>
<style lang="less" scoped>
@import url(../../assets/css/shrinkagetool/shrinkagetool.less);
</style>


